Multi Instance Exercise 6
Exercise 6: Create a Multi-Instance Job
Objective
To create a Multi Instance Job.
Summary
Create a multi instance job called, Copy Logs, with eight property sets containing a property called FILENAME with a unique value in each set. Then have multiple version of this job be built during the build of the Schedule. then validate that the files were copied with a new name consisting of the date, time, and original file name.
z cx### Instructions
Create Resource
- Create a Resource called
OpConLogs
with a Max Value of1
.
Create Managed System Properties
- Create a new version of $SCHEDULE DATE
- NAME: $SCHEDULE DATEyyyymmdd
- Value: yyyymmdd
- Create a new version of $TIME
- NAME: $TIMEhhmm
- Value: hhmm
Create the Schedule and Resource
- Create a Schedule named Multi Instance Jobs.
- Add an Instance Definition with the Name,
OpConLogPath
, with a Value ofC:\ProgramData\OpConxps\SAM\Log
. - Add a second Property with the Name,
DestinationLogPath
, with a Value ofC:\Multi-Instance\IT\OpConLogs
.
Create the Multi Instance Job
- Create a Windows job with the Allow Multi-Instance checkbox checked with the following parameters:
- Name:
Copy SubType OpCon Logs
- Job Type:
Windows
- Job Sub-Type:
Command: File Copy
- Primary Machine:
SMATraining
- User ID:
SMATRAINING\SMAUSER
- Source:
C:\ProgramData\OpConxps\SAM\Log\[[JI.FILENAME]]
- Use the Schedule Instance Property for the Path:
[[SI.OpConLogPath]]\[[JI.FILENAME]]
- Use the Schedule Instance Property for the Path:
- Destination:
C:\Multi-Instance\IT\OpConLogs\[[$SCHEDULE DATEyyyymmdd]]_[[$TIMEhhmm]]_[[JI.FILENAME]]
- Use the Schedule Instance Property for the Path:
[[SI.DestinationLogPath]]\[[$SCHEDULE DATEyyyymmdd]]_[[$TIMEhhmm]]_[[JI.FILENAME]]
- Use the Schedule Instance Property for the Path:
- Frequency: Example-Mon-Sun-O
- Instance Definitions: (each its own Property Set for a total of 8)
FILENAME=Critical.log
FILENAME=SAM.log
FILENAME=SMANetcom.log
FILENAME=SMANetcomTrace.log
FILENAME=SMANotifyHandler.log
FILENAME=SMAOpConRestApi.log
FILENAME=SMAStartTimeCalculator.log
FILENAME=SMARequestRouter.log
- Resource Dependency to the OpConLogs Resource with a Value of
1
.
Build the Schedule
- Build the Schedule for today’s date and verify the results.
- There should be 8 copies of this Job but only one should run at a time.
- The logs should be copied to the destination directory with the current date and time stamp appended to the front of the file name:
C:\Multi-Instance\IT\OpConLogs\
note
Some Jobs will likely fail with an error code 4. This is because we are copying active file and xcopy compares the source and destination files at the end of the copy.